package net.wofly.sale.order.service.impl;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import net.wofly.sale.order.repository.SaleOrderContentRepository;
import net.wofly.sale.order.domain.OrderContent;
import net.wofly.sale.order.service.ISaleOrderContentService;

@Service("iSaleOrderContentService")
@Transactional
public class SaleOrderContentServiceImpl implements ISaleOrderContentService {

	@Autowired
    SaleOrderContentRepository saleOrderContentRepository;

	@Override
	public OrderContent save(OrderContent entity) {
		return saleOrderContentRepository.save(entity);
	}

	@Override
	public void delete(OrderContent entity) {
		saleOrderContentRepository.delete(entity);
	}

	@Override
	public void delete(String key) {
		saleOrderContentRepository.delete(key);
	}
	
	@Override
	public void deleteByOrderID(String orderID) {
		saleOrderContentRepository.deleteByOrderID(orderID);
	}
	
	@Override
	public OrderContent findOne(String key) {
		return saleOrderContentRepository.findOne(key);
	}

	@Override
	public List<OrderContent> save(List<OrderContent> entityList) {
		return (List<OrderContent>) saleOrderContentRepository.save(entityList);
	}
	
	/**
	 * 刷新超时未付款的订单
	 */
	@Override
	public void orderTimeoutRefresh() {
	
		// 查询超时未付款的订单
		//订单设置为无效状态，同时更新库存
		
		
	
	}

	@Override
	public List<OrderContent> findByOrderIDIn(List<String> orderIDList) {
		return saleOrderContentRepository.findByOrderIDIn(orderIDList);
	}
}
